package com.lala.rennigou.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lala.rennigou.mapper.EasybuyUserMapper;
import com.lala.rennigou.pojo.EasybuyUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class EasybuyUserServiceImpl implements EasybuyUserService {
    @Autowired
    private EasybuyUserMapper easybuyUserMapper;

    @Override
    public EasybuyUser login(String loginName) {
        return easybuyUserMapper.login(loginName);
    }

    @Override
    public int insert(EasybuyUser easybuyUser) {
        return easybuyUserMapper.insert1(easybuyUser);
    }

    @Override
    public PageInfo<EasybuyUser> selectAll(int pagenum, int pagesize) {
        PageHelper.startPage(pagenum,pagesize);
        PageInfo pageInfo = new PageInfo(easybuyUserMapper.selectAll());
        return pageInfo;
    }

    @Override
    public int deleteById(int id) {
        return easybuyUserMapper.deleteById(id);
    }

    @Override
    public EasybuyUser selectById(int id) {
        return easybuyUserMapper.selectById(id);
    }

    public EasybuyUser seleceByAdress(int id) {
        return easybuyUserMapper.selectByIdAdress(id);
    }

    @Override
    public int update(EasybuyUser easybuyUser) {
        return easybuyUserMapper.updateById(easybuyUser);
    }

}
